package com.njzxw.fs.commonutil.repository;

import com.njzxw.fs.commonutil.bean.FileBean;
import com.njzxw.fs.commonutil.bean.MsmBean;
import com.njzxw.fs.commonutil.bean.SystemGroupBean;
import com.njzxw.fs.commonutil.bean.SystemItemBean;
import com.njzxw.fs.commonutil.db.ZxwLangDriver;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BaseRep {

    @Select("select a.groupcode,b.`values` from t_deploy_group a,t_deploy_item b where a.groupcode = b.group_id and a.siglesubitem = 0")
    List<SystemGroupBean> getSystemGroupSiglBean();

    @Select("select a.groupcode from t_deploy_group a where a.siglesubitem = 1")
    List<SystemGroupBean> getSystemGroupMoreBean();

    @Select("select a.`values`,a.name,a.remark,a.orderby,a.group_id,a.`explain` from t_deploy_item a where a.group_id = #{group_id}")
    List<SystemItemBean> getSystemGroupItemBean(@Param("group_id") String group_id);

    @Insert("insert into t_tmp_resouce (#{fileBean})")
    @Options(useGeneratedKeys = true)
    @Lang(ZxwLangDriver.class)
    int insertTemp(FileBean fileBean);

    @Select("select * from t_tmp_resouce a where a.id = #{id}")
    FileBean getTempFile(String id);

    @Insert("insert into t_resouce_file(#{fileBean})")
    @Options(useGeneratedKeys = true)
    @Lang(ZxwLangDriver.class)
    int insertFile(FileBean fileBean);

    @Select("select 1 from dual")
    int heatMysql();

    @Insert("insert into t_msm_info (#{msmBean})")
    @Options(useGeneratedKeys = true)
    @Lang(ZxwLangDriver.class)
    Integer insertMsm(MsmBean msmBean);

    @Select("select CONCAT(a.img_host,a.file_name) from t_resouce_file a where a.id = #{id}")
    String getFilePath(@Param("id") String id);


}
